0x07. Networking basics #0
- Weight: 1
- Project over - took place from Oct 4, 2023 6:00 AM to Oct 6, 2023 6:00 AM
- An auto review will be launched at the deadline
Resources
Read or watch:
- OSI model
- Different types of network
- LAN network
- WAN network
- Internet
- MAC address
- What is an IP address
- Private and public address
- IPv4 and IPv6
- Localhost
- TCP and UDP
- TCP/UDP ports List
- What is ping /ICMP
- Positional parameters
man or help:
netstatping
Learning Objectives
At the end of this project, you are expected to be able to explain to anyone, without the help of Google:
OSI Model
- What it is
- How many layers it has
- How it is organized
What is a LAN
- Typical usage
- Typical geographical size
What is a WAN
- Typical usage
- Typical geographical size
What is the Internet
- What is an IP address
- What are the 2 types of IP address
- What is
localhost - What is a subnet
- Why IPv6 was created
TCP/UDP
- What are the 2 mainly used data transfer protocols for IP (transfer level on the OSI schema)
- What is the main difference between TCP and UDP
- What is a port
- Memorize SSH, HTTP and HTTPS port numbers
- What tool/protocol is often used to check if a device is connected to a network
Copyright - Plagiarism
- You are tasked to come up with solutions for the tasks below yourself to meet with the above learning objectives.
- You will not be able to meet the objectives of this or any following project by copying and pasting someone else’s work.
- You are not allowed to publish any content of this project.
- Any form of plagiarism is strictly forbidden and will result in removal from the program.
Requirements
General
- Allowed editors:
vi,vim,emacs - All your Bash script files will be interpreted on Ubuntu 20.04 LTS
- All your files should end with a new line
- A
README.mdfile, at the root of the folder of the project, is mandatory - All your Bash script files must be executable
- Your Bash script must pass
shellcheckwithout any error - The first line of all your Bash scripts should be exactly
#!/usr/bin/env bash - The second line of all your Bash scripts should be a comment explaining what is the script doing
More Info
The second line of all your Bash scripts should be a comment explaining what is the script doing
For multiple choice question type tasks, just type the number of the correct answer in your answer file, add a new line for every new answer, example:
What is the most important position in a software company?
- Project manager
- Backend developer
- System administrator
sylvain@ubuntu$ cat foo_answer_file
3
sylvain@ubuntu$
Source for question 1 here
Tasks
0. OSI model
OSI (Open Systems Interconnection) is an abstract model to describe layered communication and computer network design. The idea is to segregate the different parts of what make communication possible.
It is organized from the lowest level to the highest level:
- The lowest level: layer 1 which is for transmission on physical layers with electrical impulse, light or radio signal
- The highest level: layer 7 which is for application specific communication like SNMP for emails, HTTP for your web browser, etc
Keep in mind that the OSI model is a concept, it’s not even tangible. The OSI model doesn’t perform any functions in the networking process. It is a conceptual framework so we can better understand complex interactions that are happening. Most of the functionality in the OSI model exists in all communications systems.
In this project we will mainly focus on:
- The Transport layer and especially TCP/UDP
- On the Network layer with IP and ICMP
The image bellow describes more concretely how you can relate to every level.
Questions:
What is the OSI model?
- Set of specifications that network hardware manufacturers must respect
- The OSI model is a conceptual model that characterizes the communication functions of a telecommunication system without regard to their underlying internal structure and technology
- The OSI model is a model that characterizes the communication functions of a telecommunication system with a strong regard for their underlying internal structure and technology
How is the OSI model organized?
- Alphabetically
- From the lowest to the highest level
- Randomly
Repo:
- GitHub repository:
alx-system_engineering-devops - Directory:
0x07-networking_basics - File:
0-OSI_model
1. Types of network
LAN connect local devices together, WAN connects LANs together, and WANs are operating over the Internet.
Questions:
What type of network a computer in local is connected to?
- Internet
- WAN
- LAN
What type of network could connect an office in one building to another office in a building a few streets away?
- Internet
- WAN
- LAN
What network do you use when you browse www.google.com from your smartphone (not connected to the Wifi)?
- Internet
- WAN
- LAN
Repo:
- GitHub repository:
alx-system_engineering-devops - Directory:
0x07-networking_basics - File:
1-types_of_network
2. MAC and IP address
Questions:
What is a MAC address?
- The name of a network interface
- The unique identifier of a network interface
- A network interface
What is an IP address?
- Is to devices connected to a network what postal address is to houses
- The unique identifier of a network interface
- Is a number that network devices use to connect to networks
Repo:
- GitHub repository:
alx-system_engineering-devops - Directory:
0x07-networking_basics - File:
2-MAC_and_IP_address
3. UDP and TCP
Let’s fill the empty parts in the drawing above.
Questions:
- Which statement is correct for the TCP box:
It is a protocol that is transferring data in a slow way but surelyIt is a protocol that is transferring data in a fast way and might loss data along in the process
- Which statement is correct for the UDP box:
It is a protocol that is transferring data in a slow way but surelyIt is a protocol that is transferring data in a fast way and might loss data along in the process
- Which statement is correct for the TCP worker:
Have you received boxes x, y, z?May I increase the rate at which I am sending you boxes?
Repo:
- GitHub repository:
alx-system_engineering-devops - Directory:
0x07-networking_basics - File:
3-UDP_and_TCP
4. TCP and UDP ports
Once packets have been sent to the right network device using IP using either UDP or TCP as a mode of transportation, it needs to actually enter the network device.
If we continue the comparison of a network device to your house, where IP address is like your postal address, UDP and TCP ports are like the windows and doors of your place. A TCP/UDP network device has 65535 ports. Some of them are officially reserved for a specific usage, some of them are known to be used for a specific usage (but nothing is officially declared) and the rest are free of use.
While the full list of ports should not be memorized, it is important to know the most used ports, let’s start by remembering 3 of them:
- 22 for SSH
- 80 for HTTP
- 443 for HTTPS
Note that a specific IP + port = socket.
Write a Bash script that displays listening ports:
- That only shows listening sockets
- That shows the PID and name of the program to which each socket belongs
Example:
sylvain@ubuntu$ sudo ./4-TCP_and_UDP_ports
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 *:sunrpc *:* LISTEN 518/rpcbind
tcp 0 0 *:ssh *:* LISTEN 1240/sshd
tcp 0 0 *:32938 *:* LISTEN 547/rpc.statd
tcp6 0 0 [::]:sunrpc [::]:* LISTEN 518/rpcbind
tcp6 0 0 [::]:ssh [::]:* LISTEN 1240/sshd
tcp6 0 0 [::]:33737 [::]:* LISTEN 547/rpc.statd
udp 0 0 *:sunrpc *:* 518/rpcbind
udp 0 0 *:691 *:* 518/rpcbind
udp 0 0 localhost:723 *:* 547/rpc.statd
udp 0 0 *:60129 *:* 547/rpc.statd
udp 0 0 *:3845 *:* 562/dhclient
udp 0 0 *:bootpc *:* 562/dhclient
udp6 0 0 [::]:47444 [::]:* 547/rpc.statd
udp6 0 0 [::]:sunrpc [::]:* 518/rpcbind
udp6 0 0 [::]:50038 [::]:* 562/dhclient
udp6 0 0 [::]:691 [::]:* 518/rpcbind
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] STREAM LISTENING 7724 518/rpcbind /run/rpcbind.sock
unix 2 [ ACC ] STREAM LISTENING 6525 1/init @/com/ubuntu/upstart
unix 2 [ ACC ] STREAM LISTENING 8559 835/dbus-daemon /var/run/dbus/system_bus_socket
unix 2 [ ACC ] STREAM LISTENING 9190 1087/acpid /var/run/acpid.socket
unix 2 [ ACC ] SEQPACKET LISTENING 7156 378/systemd-udevd /run/udev/control
sylvain@ubuntu$
Repo:
- GitHub repository:
alx-system_engineering-devops - Directory:
0x07-networking_basics - File:
4-TCP_and_UDP_ports